<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <title><!DOCTYPE html>
                <html>
                <head>
                    <meta charset="utf-8">
                    <meta name="viewport" content="width=device-width, initial-scale=1.0">
                    <title>商品列表</title>
                    <link rel="shortcut icon" href="favicon.ico">
                    <link href="/Public/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
                    <link href="/Public/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
                    <link href="/Public/Theme1/css/plugins/iCheck/custom.css" rel="stylesheet">
                    <link href="/Public/Theme1/css/animate.min.css" rel="stylesheet">
                    <link href="/Public/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">
                    <script type="text/javascript" charset="utf-8" src="/Public/Plugin/layDate/laydate/laydate.js"></script>
                    <script type="text/javascript" src="/Public/Plugin/umeditor/third-party/jquery.min.js"></script>
                </head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>商品列表
                        <!--<small><a href="<?php echo U('/Admin/Good/edit');?>" style="margin-left: 15px; color: #06cbc4">添加活动</a>-->
                        <!--</small>-->
                    </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>

                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>

                    <div class="ibox-content">

                        <form method="post" action="/index.php?s=/Admin/Good/activityList" class="form-horizontal"
                              enctype="multipart/form-data">
                            <div class="form-group">
                                <button id="btn" class="btn btn-success" type="submit">搜索</button>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" value="<?php echo ($keyword); ?>" name="keyword"
                                           id="keyword" placeholder="请输入活动名称">
                                </div>
                                <div class="col-sm-2">
                                    <select class="form-control" required name="menu_id" id="menu_id">
                                        <option value="-1">全部</option>
                                        <?php if(is_array($menu)): $i = 0; $__LIST__ = $menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option
                                            <?php if($vo['id'] == $menu_id): ?>selected<?php endif; ?>
                                            value="<?php echo ($vo['id']); ?>"><?php echo ($vo['name']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>
                                </div>
                            </div>
                        </form>
                             <a href="<?php echo U('Admin/Good/edit_a_good',array('id'=>$result['id']));?>">
                                            <button class="btn btn-danger">新增</button>
                                        </a>
                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>商品标题</th>
                                <th>商品原价</th>
                                <th>商品现价</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$result): $mod = ($i % 2 );++$i;?><tr>
                                    <td><?php echo ($result["id"]); ?></td>
                                    <td><?php echo ($result["title"]); ?></td>
                                    <td><?php echo ($result["yuanjia"]); ?></td>
                                    <td><?php echo ($result["xianjia"]); ?></td>
                                    <td>
                                        <a href="<?php echo U('Admin/Good/edit_a_good',array('id'=>$result['id']));?>">
                                            <button class="btn btn-warning">编辑</button>
                                        </a>
                                        <a onclick="delGood(<?php echo ($result['id']); ?>)">
                                            <button class="btn btn-danger">删除</button>
                                        </a>
                                    </td>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                        <div class="pagination" style="margin:0px;">
                            <?php echo ($page); ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>


    </div>

    <script src="/Public/Theme1/js/jquery.min.js?v=2.1.4"></script>
    <script src="/Public/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/Public/Theme1/js/content.min.js?v=1.0.0"></script>
    <script src="/Public/Theme1/js/plugins/iCheck/icheck.min.js"></script>
    <script src="/Public/layer/layer.js"></script>
    <script>
        $(document).ready(function () {
            $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green",})
        });
        function delActivity(id) {
            layer.alert('确定要删除吗?', {
                skin: 'layui-layer-molv' //样式类名  自定义样式
                , closeBtn: 1    // 是否显示关闭按钮
                , anim: 1 //动画类型
                , btn: ['确认', '取消'] //按钮
                , icon: 6    // icon
                , yes: function () {
                    window.location.href = "/index.php?s=/Admin/Good/delActivity/id/" + id;
                }
                , btn2: function () {
                }
            });
        }
        laydate.render({
            elem: '#start_time' //指定元素
        });
        laydate.render({
            elem: '#end_time' //指定元素
        });

        function exportExcel() {
            var options = $("#menu_id option:selected");
            var keyword = $("#keyword").val();
            var start_time = $("#start_time").val();
            var end_time = $("#end_time").val();
            window.location.href = "/index.php?s=/Admin/Good/export/menu_id/" + options.val() + '/keyword/' + keyword + '/start_time/' + start_time + '/end_time/' + end_time;

        }
    </script>
</body>
</html>